package com.jxgc.file.oi;

public class arraydemo3 {
    public static void main(String[] args) {
        //目标：掌握定义数组的方式二：动态初始化数组
        //数据类型 [] 数组名 = new  数据类型[数据长度]
        int[]  ages = new int [3];
        System.out.println(ages[0]);
        System.out.println(ages[1]);
        System.out.println(ages[2]);  //默认初始化数值是0

        //对数组进行赋值
        ages[0] = 12;
        ages[1] = 18;
        ages[2] = 32;

        System.out.println(ages[0]);
        System.out.println(ages[1]);
        System.out.println(ages[2]);
        System.out.println("-----------------------------------------------");
        //动态初始化数组元素默认值规则
        char[] chars = new char[3];
        System.out.println((int)chars[0]);//这里得到了1个未知字符  其实他是0 ，要对他进行强制类型转化

        double[] scores = new double[80];
        System.out.println(scores[0]);
        System.out.println(scores[79]);
        System.out.println("-----------------------------");

    }
}
